# -*- coding:utf-8 -*-
from sqlalchemy import create_engine, Column, Integer, Text, String
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
import pymysql

import config

pymysql.install_as_MySQLdb()
engine = create_engine(config.sqlalchemy_uri)
Session = sessionmaker(bind = engine)
base = declarative_base()
session = Session()


class Task(base):
    __tablename__ = "task"
    task_id = Column(Integer, primary_key = True)
    prob_id = Column(Integer)
    language = Column(String(10))
    code = Column(Text)


class Record(base):
    __tablename__ = "record"
    id = Column(Integer, primary_key = True)
    user_id = Column(Integer)
    prob_id = Column(Integer)
    language = Column(String(10))
    code = Column(Text)
    status = Column(String(100))
    score = Column(Integer)
    result = Column(Text)
